/**
 * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.srwl.mytx.dao;

import android.content.ContentValues;
import android.content.Context;

import com.srwl.mytx.domain.Notify;

import java.util.List;


@Deprecated
public class InviteMessgeDao {
    static final String TABLE_NAME = "new_friends_msgs";
    static final String COLUMN_NAME_ID = "id";
    static final String COLUMN_NAME_OBJECT_ID = "objectId";
    static final String COLUMN_NAME_FROM = "username";
    static final String COLUMN_NAME_GROUP_ID = "groupid";
    static final String COLUMN_NAME_GROUP_Name = "groupname";
    public static final String COLUMN_NAME_CONTACT_ID= "c_id";
    public static final String COLUMN_NAME_TARGET_CONTACT_ID= "t_cid";
    public static final String COLUMN_NAME_TIME = "time";
    public static final String COLUMN_NAME_REASON = "reason";
    public static final String COLUMN_NAME_REALATION="realation";
    public static final String COLUMN_NAME_STATUS = "status";
    static final String COLUMN_NAME_ISINVITEFROMME = "isInviteFromMe";
    static final String COLUMN_NAME_GROUPINVITER = "groupinviter";
    static final String COLUMN_NAME_NICK = "nick";
    static final String COLUMN_NAME_AVATAR = "avatar";
    static final String COLUMN_NAME_SEX = "sex";
    static final String COLUMN_NAME_AREA = "area";
    static final String COLUMN_NAME_INSTALLATION_ID = "installationId";


    static final String COLUMN_NAME_UNREAD_MSG_COUNT = "unreadMsgCount";


    public InviteMessgeDao(Context context) {
    }

    /**
     * save message
     * @param message
     * @return return cursor of the message
     */
    public Integer saveMessage(Notify message) {
        return DemoDBManager.getInstance().saveMessage(message);
    }
    // TODO: 2017/7/3 0003  应该还有一个保存方法 saveMessage(List<Notify>  messageListView)

    /**
     * update message
     * @param msgId
     * @param values
     */
    public void updateMessage(String msgId, ContentValues values) {
        DemoDBManager.getInstance().updateMessage(msgId, values);
    }

    /**
     * get messges
     * @return
     */
    public List<Notify> getMessagesList() {
        return DemoDBManager.getInstance().getMessagesList();
    }

    /**
     * 对方的_User的objectId
     * @param targetUserId
     */
    public void deleteMessage(String targetUserId) {
        DemoDBManager.getInstance().deleteMessage(targetUserId);
    }

    public void deleteAllNoticeMessage() {
        DemoDBManager.getInstance().deleteAllNoticeMessage();
    }

    public int getUnreadMessagesCount() {
        return DemoDBManager.getInstance().getUnreadNotifyCount();
    }

    public void saveUnreadMessageCount(int count) {
        DemoDBManager.getInstance().setUnreadNotifyCount(count);
    }
}
